package com.yixun.qfbao.model.enums;

/**
 * 价格枚举
 * @author zilong.liu
 *
 */
public enum PriceEnum {

	PRICE_0_200(1, "200万以下", 0, 200),
	PRICE_200_250(2, "200-250万", 200, 250),
	PRICE_250_300(3, "250-300万", 250, 300),
	PRICE_300_400(4, "300-400万", 300, 400);
	
	private int no;
	
	private String des;
	
	private int minPrice;
	
	private int maxPrice;

	PriceEnum(int no, String des, int minPrice, int maxPrice){
		this.no = no;
		this.des = des;
		this.minPrice = minPrice;
		this.maxPrice = maxPrice;
	}
	
	/**
	 * 根据number查找最小最大值
	 * @param number
	 * @return
	 */
	public static int[] getMinAndMaxValueByNumber(int number) {
		for (PriceEnum priceEnum : PriceEnum.values()) {
			if(number == priceEnum.getNo()) {
				return new int[] {priceEnum.getMinPrice(), priceEnum.getMaxPrice()};
			}
		}
		return null;
	}
	
	/**
	 * 根据number 查找描述
	 * @param number
	 * @return
	 */
	public String getDescByNumber(int number) {
		for (PriceEnum priceEnum : PriceEnum.values()) {
			if(number == priceEnum.getNo()) {
				return priceEnum.getDes();
			}
		}
		return "";
	}
	
	public int getNo() {
		return no;
	}

	public String getDes() {
		return des;
	}

	public int getMinPrice() {
		return minPrice;
	}

	public int getMaxPrice() {
		return maxPrice;
	}
}
